/*
 * ECARX Technology Limited is the owner of the copyright and the trade secret of this software.
 * Without permission, no one has the right to obtain, disclose or use this software in any way.
 */
package com.ecarx.systemui.plugin.ui.navigationbar

import android.content.Context
import android.util.AttributeSet
import android.view.Display
import com.ecarx.systemui.plugin.R
import com.ecarx.systemui.plugin.ui.custom.SystemBarButton
import com.ecarx.systemui.plugin.utils.AppUtils
import com.ecarx.systemui.plugin.utils.BitmapUtils

class SeatAdjustPanelButton : SystemBarButton {


    private var isCsd = false

    constructor(context: Context?) : this(context!!, null)
    constructor(context: Context?, attrs: AttributeSet?) : this(context!!, attrs, 0)
    constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(
        context!!,
        attrs,
        defStyleAttr
    )

    override fun initView() {
        super.initView()


    }

    override fun onAttachedToWindow() {
        super.onAttachedToWindow()
        isCsd = display.displayId == Display.DEFAULT_DISPLAY
        setImageBitmap(
            BitmapUtils.decodeRes(
                context,
                if (isCsd) R.drawable.ic_nav_seatadjust else R.drawable.ic_psd_nav_seatadjust
            )
        )

        setOnClickListener {
            AppUtils.startSeatAdjust(context, isCsd)
        }
    }

    override fun getContentDescriptionString(): String {
        return "SeatAdjustPanelButton"
    }

}